package com.infnoon.ojback.judge.codesandbox;

import com.infnoon.ojback.judge.codesandbox.model.ExecuteCodeRequest;
import com.infnoon.ojback.judge.codesandbox.model.ExecuteCodeResponse;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/***
 * 这个代理必须要传入原始的参数 所以用AllArgsConstructor
 * 也可以 public 定义 懒了
 */
@Slf4j
@AllArgsConstructor
public class CodeSandboxProxy implements CodeSandbox {
    private final CodeSandbox codeSandbox;

    @Override
    public ExecuteCodeResponse executeCode(ExecuteCodeRequest executeCodeRequest) {
        log.info("代码沙箱请求信息:{}", executeCodeRequest.toString());
        ExecuteCodeResponse executeCodeResponse = codeSandbox.executeCode(executeCodeRequest);
        log.info("代码沙箱响应信息:{}", executeCodeResponse.toString());
        return executeCodeResponse;
    }
}
